home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / woop.com / WINDOW.DOC < prev    next >
Encoding:
Text File  |  1990-04-07  |  18.4 KB  |  818 lines

  1.  
  2.     window.doc
  3.  
  4.     Version:    1.31
  5.     Author:     kat
  6.     Create:     11/10/89
  7.     Update:     04/02/90
  8.  
  9.  
  10.     Window management OOP style
  11.  
  12.  
  13.  
  14.  
  15.     window Interface Documentation
  16.  
  17. Summary
  18.  
  19. A window object is created by a wdw_open with handle returned. All
  20. subsequent operations must use the handle to distinquish among windows.
  21. The wdw_init* functions set the object descriptor values, such as dimension,
  22. border style, attributes, etc. wdw_put makes the window appear on the screen,
  23. while wdw_remove removes it. wdw_close destroys the window object.
  24.  
  25. Pop-up prompts and pop-up menus utilize windows.
  26.  
  27. Library includes video/keyboard functions which are independent from
  28. windows. These functions are not prefixed by wdw_.
  29.  
  30.  
  31. List of Functions
  32.  
  33.     Window
  34.  
  35. int  wdw_init ( int, int, int);
  36. void wdw_init_style( int, int, int, int);
  37. void wdw_init_position( int, int, int);
  38. void wdw_put     ( int );
  39. void wdw_remove ( int );
  40. void wdw_clear  ( int );
  41. void wdw_fill   ( int, char);
  42. void wdw_scroll_down    ( int, char *);
  43. void wdw_scroll_up      ( int, char *);
  44. void wdw_display ( int, int, int, char *, char);
  45. int  wdw_open()
  46. void wdw_close( int )
  47. int  wdw_start()
  48. void wdw_end()
  49.  
  50.     Video/keyboard
  51.  
  52. void video_init();
  53. int  mono();
  54. void display ( int, int, char *, char);
  55. void cursor_off();
  56. void cursor_on();
  57. void clear_screen();
  58. void clear_line (int);
  59. void keyboard_flush();
  60. int  pop_up_prompt( int, int, int,  char, char, char, char *, char *);
  61. int  prompt      ( int, int, int,  char, char, char *, char *);
  62. int  pop_up_menu  ( int, int, char, char, char, char *, char *);
  63.  
  64.  
  65.  
  66. Notes
  67.  
  68.  
  69.  
  70. /*    Use the following reference pattern for each interface function  */
  71.  
  72.  
  73. --------------------------------------------------------------------------
  74.  wdw_
  75. --------------------------------------------------------------------------
  76.  
  77.  Function       .
  78.  
  79.  Syntax
  80.  
  81.  Arguments
  82.  
  83.  
  84.  
  85.  Remarks
  86.  
  87.  
  88.  Return value
  89.  
  90.  Limitations
  91.  
  92.  See also
  93.  
  94.  Example
  95.  
  96.  
  97. --------------------------------------------------------------------------
  98.  wdw_init
  99. --------------------------------------------------------------------------
  100.  
  101.  Function       Initialize window size.
  102.  
  103.  Syntax         int wdw_init(int handle, int no_of_rows, int no_of_cols)
  104.  
  105.  Arguments      handle        - object handle
  106.         no_of_rows - dimension > 2
  107.                 no_of_cols - dimension > 2
  108.  
  109.  
  110.  Remarks        Must be the next call after open to set window dimension
  111.         and allocate memory for overlap and current content.
  112.  
  113.  
  114.  Return value   true  - memory for window buffers allocated ok
  115.         false - failed to allocate memory
  116.  
  117.  Limitations    Dimension must be greater than 2 because border takes
  118.         up 2 lines.
  119.  
  120.  See also       wdw_init_style, wdw_init_position
  121.  
  122.  Example        if ( wdw_init ( rolodex, Rolodex_rows, Rolodex_cols) )
  123.         begin_if
  124.                   ...
  125.                   ...
  126.         end_if
  127.  
  128.  
  129. --------------------------------------------------------------------------
  130. wdw_init_style
  131. --------------------------------------------------------------------------
  132.  
  133.  Function       Initilize style parameters.
  134.  
  135.  Syntax         void wdw_init_style( int handle, int style,
  136.                      int border_attr, int background);
  137.  
  138.  Arguments      handle
  139.                 style         - No_border, Solid_border, Single_border,
  140.                   Double_border
  141.                 border_attr - attribute for border
  142.                 background  - attribute for background
  143.  
  144.  Remarks        Sets window object parameters.
  145.  
  146.  
  147.  Return value
  148.  
  149.  Limitations
  150.  
  151.  See also       wdw_init, wdw_init_position
  152.  
  153.  Example        wdw_init_style ( rolodex, Double_border, Red, Blue);
  154.  
  155.  
  156. --------------------------------------------------------------------------
  157. wdw_init_position
  158. --------------------------------------------------------------------------
  159.  
  160.  Function       Set screen display position of window.
  161.  
  162.  Syntax         void wdw_init_position( int handle, int display_row,
  163.                     int display_col);
  164.  
  165.  Arguments      handle
  166.         display_row - upper left corner row    0 - 24
  167.         display_col - upper left corner column 0 - 79
  168.  
  169.  
  170.  
  171.  Remarks
  172.  
  173.  
  174.  Return value
  175.  
  176.  Limitations    Window must fit with border on screen.
  177.  
  178.  See also       wdw_init, wdw_init_style
  179.  
  180.  Example        wdw_init_position ( rolodex, Rolodex_row_pos, Rolodex_col_pos);
  181.  
  182.  
  183.  
  184. --------------------------------------------------------------------------
  185.  mono()
  186. --------------------------------------------------------------------------
  187.  
  188.  Function       Test if monitor is monochromatic.
  189.  
  190.  Syntax         int mono();
  191.  
  192.  Arguments
  193.  
  194.  
  195.  
  196.  Remarks
  197.  
  198.  
  199.  Return value   true  - monchromatic
  200.             false - color
  201.  
  202.  Limitations
  203.  
  204.  See also
  205.  
  206.  Example
  207.         if ( mono () )
  208.           attribute = White On Black;
  209.         else
  210.           attribute = Yellow On Blue;
  211.  
  212.  
  213.  
  214. --------------------------------------------------------------------------
  215.  keyboard_flush()
  216. --------------------------------------------------------------------------
  217.  
  218.  Function       Flush keyboard of waiting key characters.
  219.  
  220.  Syntax         void keyboard_flush()
  221.  
  222.  Arguments
  223.  
  224.  
  225.  
  226.  Remarks
  227.  
  228.  
  229.  Return value
  230.  
  231.  Limitations
  232.  
  233.  See also
  234.  
  235.  Example    keyboard_flush();
  236.  
  237.  
  238.  
  239. --------------------------------------------------------------------------
  240. video_init
  241. --------------------------------------------------------------------------
  242.  
  243.  Function       Video initialization - not related to window object.
  244.  
  245.  Syntax         void video_init()
  246.  
  247.  Arguments
  248.  
  249.  
  250.  
  251.  Remarks        Checks if monitor is mono or color. Sets defaults.
  252.         Called from wdw_start when windowing is used.
  253.         If display() is used without windowing, then
  254.         video_init must be called prior to any video functions.
  255.  
  256.  
  257.  Return value
  258.  
  259.  Limitations
  260.  
  261.  See also       display
  262.  
  263.  Example        video_init();
  264.  
  265.  
  266. --------------------------------------------------------------------------
  267. wdw_put
  268. --------------------------------------------------------------------------
  269.  
  270.  Function       Makes window visible on the screen.
  271.  
  272.  Syntax         void wdw_put( int handle)
  273.  
  274.  Arguments      handle
  275.  
  276.  
  277.  
  278.  Remarks        A window object becomes visible by this function.
  279.                 It saves overlap area before displaying window.
  280.  
  281.  
  282.  Return value
  283.  
  284.  Limitations
  285.  
  286.  See also       wdw_remove
  287.  
  288.  Example        wdw_put( rolodex);
  289.  
  290.  
  291. --------------------------------------------------------------------------
  292. wdw_remove
  293. --------------------------------------------------------------------------
  294.  
  295.  Function       Removes window from the screen.
  296.  
  297.  Syntax         void wdw_remove ( int handle);
  298.  
  299.  Arguments      handle
  300.  
  301.  
  302.  
  303.  Remarks        Restores overlap area, thus making window disappear.
  304.  
  305.  
  306.  Return value
  307.  
  308.  Limitations
  309.  
  310.  See also       wdw_put
  311.  
  312.  Example        wdw_remove( rolodex );
  313.  
  314.  
  315. --------------------------------------------------------------------------
  316. wdw_clear
  317. --------------------------------------------------------------------------
  318.  
  319.  Function       Clears window.
  320.  
  321.  Syntax         void wdw_clear  ( int handle);
  322.  
  323.  Arguments      handle
  324.  
  325.  
  326.  
  327.  Remarks
  328.  
  329.  
  330.  Return value
  331.  
  332.  Limitations
  333.  
  334.  See also
  335.  
  336.  Example        wdw_clear( rolodex );
  337.  
  338.  
  339. --------------------------------------------------------------------------
  340. wdw_fill
  341. --------------------------------------------------------------------------
  342.  
  343.  Function       Fills window with a selected character.
  344.  
  345.  Syntax         wdw_fill   ( int handle, char fill_char)
  346.  
  347.  Arguments      handle
  348.         fill_char - fill character
  349.  
  350.  
  351.  
  352.  Remarks
  353.  
  354.  
  355.  Return value
  356.  
  357.  Limitations
  358.  
  359.  See also
  360.  
  361.  Example        wdw_fill ( rolodex, Under_bar );
  362.  
  363.  
  364.  
  365. --------------------------------------------------------------------------
  366.  wdw_scroll_down
  367. --------------------------------------------------------------------------
  368.  
  369.  Function       Scroll down window one line, display new top line.
  370.  
  371.  Syntax         void wdw_scroll_up( int handle, char *new_line)
  372.  
  373.  Arguments      handle     - window handle
  374.         new_line   - top line text
  375.  
  376.  
  377.  
  378.  Remarks        Window is scrolled down one line. Bottom line disappears.
  379.         Top line is cleared. New top text is displayed.
  380.  
  381.  
  382.  Return value
  383.  
  384.  Limitations
  385.  
  386.  See also        wdw_scroll_up
  387.  
  388.  Example         wdw_scroll_down( Telephone_window, Name_telephone);
  389.  
  390.  
  391.  
  392. --------------------------------------------------------------------------
  393.  wdw_scroll_up
  394. --------------------------------------------------------------------------
  395.  
  396.  Function       Scroll up window one line, display new bottom line.
  397.  
  398.  Syntax         void wdw_scroll_up( int handle, char *new_line)
  399.  
  400.  Arguments      handle     - window handle
  401.         new_line   - bottom line text
  402.  
  403.  
  404.  
  405.  Remarks        Window is scrolled up one line. Top line disappears.
  406.         Bottom line is cleared. New bottom text is displayed.
  407.  
  408.  
  409.  Return value
  410.  
  411.  Limitations
  412.  
  413.  See also        wdw_scroll_down
  414.  
  415.  Example         wdw_scroll_up( Telephone_window, Name_telephone);
  416.  
  417.  
  418.  
  419. --------------------------------------------------------------------------
  420. wdw_display
  421. --------------------------------------------------------------------------
  422.  
  423.  Function       Display text in window.
  424.  
  425.  Syntax         void wdw_display ( int handle, int row, int col,
  426.                    char *text, char attribute);
  427.  
  428.  Arguments      handle
  429.         row       -  1 is first row
  430.         col       -  1 is first column
  431.                 text
  432.                 attribute
  433.  
  434.  
  435.  Remarks
  436.  
  437.  
  438.  Return value
  439.  
  440.  Limitations
  441.  
  442.  See also
  443.  
  444.  Example        wdw_display ( rolodex, Title_row, Title_col, Title_text, Blue);
  445.  
  446.  
  447.  
  448. --------------------------------------------------------------------------
  449. display
  450. --------------------------------------------------------------------------
  451.  
  452.  Function       Displays text on screen - no relation to window objects.
  453.  
  454.  Syntax         void display ( int row, int col, char *text, char attr)
  455.  
  456.  Arguments      row     - row     0 - 24
  457.                 col     - column  0 - 79
  458.                 text
  459.                 attr      - attribute
  460.  
  461.  Remarks
  462.  
  463.  
  464.  Return value
  465.  
  466.  Limitations
  467.  
  468.  See also
  469.  
  470.  Example        display ( Warning_row, Warning_col, Warning_text, Red);
  471.  
  472.  
  473. --------------------------------------------------------------------------
  474.  clear_screen
  475. --------------------------------------------------------------------------
  476.  
  477.  Function       Erases screen completely.
  478.  
  479.  Syntax         void clear_screen()
  480.  
  481.  Arguments
  482.  
  483.  
  484.  
  485.  Remarks
  486.  
  487.  
  488.  Return value
  489.  
  490.  Limitations
  491.  
  492.  See also
  493.  
  494.  Example     clear_screen();
  495.  
  496.  
  497. --------------------------------------------------------------------------
  498.  clear_line
  499. --------------------------------------------------------------------------
  500.  
  501.  Function       Erases line completely.
  502.  
  503.  Syntax         void clear_line(int row)
  504.  
  505.  Arguments      row - line to be cleared 1 to 25
  506.  
  507.  
  508.  
  509.  Remarks
  510.  
  511.  
  512.  Return value
  513.  
  514.  Limitations
  515.  
  516.  See also
  517.  
  518.  Example        clear_line( Error_row );
  519.  
  520.  
  521. --------------------------------------------------------------------------
  522.  cursor_off
  523. --------------------------------------------------------------------------
  524.  
  525.  Function       Turns cursor off.
  526.  
  527.  Syntax         void cursor_off()
  528.  
  529.  Arguments
  530.  
  531.  
  532.  
  533.  Remarks        Cursor will not be seen until it is turned on.
  534.  
  535.  
  536.  Return value
  537.  
  538.  Limitations
  539.  
  540.  See also       cursor_on
  541.  
  542.  Example        cursor_off();
  543.  
  544.  
  545. --------------------------------------------------------------------------
  546.  cursor_on
  547. --------------------------------------------------------------------------
  548.  
  549.  Function       Turns cursor on.
  550.  
  551.  Syntax         void cursor_on()
  552.  
  553.  Arguments
  554.  
  555.  
  556.  
  557.  Remarks
  558.  
  559.  
  560.  Return value
  561.  
  562.  Limitations
  563.  
  564.  See also       cursor_off
  565.  
  566.  Example        cursor_on();
  567.  
  568.  
  569.  
  570. --------------------------------------------------------------------------
  571.  wdw_open
  572. --------------------------------------------------------------------------
  573.  
  574.  Function       Creates an object.
  575.  
  576.  Syntax         int wdw_open()
  577.  
  578.  Arguments
  579.  
  580.  
  581.  
  582.  Remarks        If creation succesful, memory is allocated for object,
  583.             and a handle is returned.
  584.  
  585.  
  586.  Return value   >=0 ok, handle is returned
  587.                 eof failed to create object
  588.  Limitations
  589.  
  590.  See also       wdw_close
  591.  
  592.  Example        if ( ( handle = wdw_open() ) == eof )
  593.           ret = false;
  594.  
  595.  
  596. --------------------------------------------------------------------------
  597.  wdw_close
  598. --------------------------------------------------------------------------
  599.  
  600.  Function        Destroys object.
  601.  
  602.  Syntax          void wdw_close ( int handle)
  603.  
  604.  Arguments       handle - handle of object to be destroyed
  605.  
  606.  
  607.  
  608.  Remarks         Deallocates memory, releases handle.
  609.  
  610.  
  611.  Return value
  612.  
  613.  Limitations
  614.  
  615.  See also        wdw_open
  616.  
  617.  Example         wdw_close( stack_handle );
  618.  
  619.  
  620.  
  621.  
  622. --------------------------------------------------------------------------
  623.  wdw_start
  624. --------------------------------------------------------------------------
  625.  
  626.  Function       Allocates memory for module structure.
  627.  
  628.  Syntax         int wdw_start()
  629.  
  630.  Arguments
  631.  
  632.  
  633.  
  634.  Remarks        Should be called at the beginning of the program.
  635.  
  636.  
  637.  
  638.  Return value   true:  allocation is ok, module can be used
  639.                 false: failure to allocate, module is not active
  640.  
  641.  Limitations
  642.  
  643.  See also       wdw_end
  644.  
  645.  Example        if ( not wdw_start() )
  646.           ret = eof;
  647.  
  648.  
  649. --------------------------------------------------------------------------
  650.  wdw_end
  651. --------------------------------------------------------------------------
  652.  
  653.  Function       Deallocates memory of module structure.
  654.  
  655.  Syntax         void wdw_end()
  656.  
  657.  Arguments
  658.  
  659.  
  660.  Remarks        Should be called at the end of the program.
  661.  
  662.  
  663.  Return value
  664.  
  665.  Limitations
  666.  
  667.  See also       wdw_start
  668.  
  669.  Example        wdw_end();
  670.  
  671.  
  672. --------------------------------------------------------------------------
  673.  pop_up_prompt
  674. --------------------------------------------------------------------------
  675.  
  676.  Function       Prompts for key entry in a one line window.
  677.  
  678.  Syntax         int prop_up_prompt( int row, int col, int length,
  679.         char message_attr, char input_attr,
  680.         char *message, char *dest)
  681.  
  682.  Arguments      row            - window upper left corner row
  683.         col            - ditto                    column
  684.         length         - maximum input length
  685.                 message_attr     - prompt attribute
  686.         input_attr       - input attribute
  687.         messagge         - prompt text
  688.         dest             - keyed string output pointer
  689.  
  690.  
  691.  
  692.  Remarks        Self-sufficient input prompt. It opens its own window.
  693.         Screen is restored after entry.
  694.  
  695.  
  696.  Return value   true  - entry
  697.         false - no entry
  698.  
  699.  Limitations
  700.  
  701.  See also       prompt
  702.  
  703.  Example        pop_up_prompt( Entry_row, Entry_col, Address_length, Green,
  704.                        Yellow, Address_prompt, address);
  705.  
  706.  
  707. --------------------------------------------------------------------------
  708.  prompt
  709. --------------------------------------------------------------------------
  710.  
  711.  Function       Prompts for key entry.
  712.  
  713.  Syntax         int prompt( int row, int col, int length,
  714.         char message_attr, char input_attr,
  715.         char *message, char *dest)
  716.  
  717.  Arguments      row            - prompt row
  718.         col            - prompt column
  719.         length         - maximum input length
  720.                 message_attr     - prompt attribute
  721.         input_attr       - input attribute
  722.         messagge         - prompt text
  723.         dest             - keyed string output pointer
  724.  
  725.  
  726.  
  727.  Remarks        Prompts for input. It does not clean up after entry.
  728.  
  729.  
  730.  Return value   true  - entry
  731.         false - no entry
  732.  
  733.  Limitations
  734.  
  735.  See also       pop_up_prompt
  736.  
  737.  Example        prompt( Entry_row, Entry_col, Address_length, Green,
  738.                 Yellow, Address_prompt, address);
  739.  
  740.  
  741. --------------------------------------------------------------------------
  742.  pop_up_menu
  743. --------------------------------------------------------------------------
  744.  
  745.  Function       Pop up menu with title and choices.
  746.  
  747.  Syntax         pop_up_menu( int row, int col, char message_attr,
  748.                  char border_attr, char bar_attr,
  749.                  char *title, char *choices);
  750.  
  751.  Arguments      row        - upper left row of window
  752.         col        - ditto      column
  753.                 message_attr    - text attribute
  754.         border_attr     - border attribute
  755.         bar_attr    - menu bar attribute
  756.         title        - menu title
  757.         choices        - choices separated by "|"
  758.  
  759.  Remarks        Cursor keys position bar, enter key selects option.
  760.                 It opens its own window and closes it after completion.
  761.  
  762.  Return value   0  - Esc key pressed, no selection
  763.         >0 - selected item sequence number
  764.  
  765.  
  766.  Limitations
  767.  
  768.  See also
  769.  
  770.  Example
  771.  
  772. #define Main_menu_title     "Mailing List"
  773. #define Main_menu_choices     "Review|Change|Add|Delete|Print|Exit"
  774.  
  775. option = pop_up_menu( Main_menu_row, Main_menu_col,
  776.                       Red, Hi_cyan, Black On White,
  777.                       Main_menu_title, Main_menu_choices);
  778.  
  779.      End of window Interface Documentation
  780.  
  781.          ----------------end-of-author's-documentation---------------
  782.  
  783.                         Software Library Information:
  784.  
  785.                    This disk copy provided as a service of
  786.  
  787.                         The Public (Software) Library
  788.  
  789.          We are not the authors of this program, nor are we associated
  790.          with the author in any way other than as a distributor of the
  791.          program in accordance with the author's terms of distribution.
  792.  
  793.          Please direct shareware payments and specific questions about
  794.          this program to the author of the program, whose name appears
  795.          elsewhere in  this documentation. If you have trouble getting
  796.          in touch with the author,  we will do whatever we can to help
  797.          you with your questions. All programs have been tested and do
  798.          run.  To report problems,  please use the form that is in the
  799.          file PROBLEM.DOC on many of our disks or in other written for-
  800.          mat with screen printouts, if possible.  The P(s)L cannot de-
  801.          bug programs over the telephone.
  802.  
  803.          Disks in the P(s)L are updated monthly, so if you did not get
  804.          this disk  directly from the P(s)L,  you should be aware that
  805.          the files in this set may no  longer be the current versions.
  806.  
  807.          For a copy of the latest monthly software library newsletter
  808.          and a list of the 2,000+ disks in the library, call or write
  809.  
  810.                         The Public (Software) Library
  811.                               P.O.Box 35705 - F
  812.                            Houston, TX 77235-5705
  813.                             Orders: 800-2424-PSL
  814.                             Info:   713-524-6394
  815.                             FAX #:  713-524-6398
  816.                             CIS ID: 71355,470
  817.  
  818.